<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>netCDF4.MFTime</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="netCDF4-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="netCDF4-module.html">Module&nbsp;netCDF4</a> ::
        Class&nbsp;MFTime
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<!-- ==================== TYPE DESCRIPTION ==================== -->
<h1 class="epydoc">type MFTime</h1><p class="nomargin-top"></p>
<pre class="base-tree">
object --+    
         |    
 _Variable --+
             |
            <strong class="uidshort">MFTime</strong>
</pre>

<hr />
<p>MFTime(self, time, units=None)</p>
  <p>Class providing an interface to a MFDataset time Variable by imposing 
  a unique common time unit to all files.</p>
  <p>Example usage:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">import</span> numpy
<span class="py-prompt">&gt;&gt;&gt; </span>f1 = Dataset(<span class="py-string">'mftest_1.nc'</span>,<span class="py-string">'w'</span>, format=<span class="py-string">'NETCDF4_CLASSIC'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>f2 = Dataset(<span class="py-string">'mftest_2.nc'</span>,<span class="py-string">'w'</span>, format=<span class="py-string">'NETCDF4_CLASSIC'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>f1.createDimension(<span class="py-string">'time'</span>,None)
<span class="py-prompt">&gt;&gt;&gt; </span>f2.createDimension(<span class="py-string">'time'</span>,None)
<span class="py-prompt">&gt;&gt;&gt; </span>t1 = f1.createVariable(<span class="py-string">'time'</span>,<span class="py-string">'i'</span>,(<span class="py-string">'time'</span>,))
<span class="py-prompt">&gt;&gt;&gt; </span>t2 = f2.createVariable(<span class="py-string">'time'</span>,<span class="py-string">'i'</span>,(<span class="py-string">'time'</span>,))
<span class="py-prompt">&gt;&gt;&gt; </span>t1.units = <span class="py-string">'days since 2000-01-01'</span>
<span class="py-prompt">&gt;&gt;&gt; </span>t2.units = <span class="py-string">'days since 2000-02-01'</span>
<span class="py-prompt">&gt;&gt;&gt; </span>t1.calendar = <span class="py-string">'standard'</span>
<span class="py-prompt">&gt;&gt;&gt; </span>t2.calendar = <span class="py-string">'standard'</span>
<span class="py-prompt">&gt;&gt;&gt; </span>t1[:] = numpy.arange(31)
<span class="py-prompt">&gt;&gt;&gt; </span>t2[:] = numpy.arange(30)
<span class="py-prompt">&gt;&gt;&gt; </span>f1.close()
<span class="py-prompt">&gt;&gt;&gt; </span>f2.close()
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Read the two files in at once, in one Dataset.</span>
<span class="py-prompt">&gt;&gt;&gt; </span>f = MFDataset(<span class="py-string">'mftest*nc'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>t = f.variables[<span class="py-string">'time'</span>]
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> t.units
<span class="py-output">days since 2000-01-01</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> t[32] <span class="py-comment"># The value written in the file, inconsistent with the MF time units.</span>
<span class="py-output">1</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>T = MFTime(t)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> T[32]                        
<span class="py-output">32</span></pre>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Instance Methods</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netCDF4.MFTime-class.html#__getitem__" class="summary-sig-name">__getitem__</a>(<span class="summary-sig-arg">...</span>)</span><br />
      Get records from a concatenated set of variables.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="netCDF4.MFTime-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">time</span>,
        <span class="summary-sig-arg">units</span>=<span class="summary-sig-default">None</span>)</span><br />
      Create a time Variable with units consistent across a multifile 
      dataset.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>_Variable</code></b>:
      <code>__getattr__</code>,
      <code>__len__</code>,
      <code>__str__</code>,
      <code>ncattrs</code>,
      <code>set_auto_maskandscale</code>,
      <code>typecode</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Class Variables</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="__qualname__"></a><span class="summary-name">__qualname__</span> = <code title="'MFTime'"><code class="variable-quote">'</code><code class="variable-string">MFTime</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Method Details</span></td>
</tr>
</table>
<a name="__getitem__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__getitem__</span>(<span class="sig-arg">...</span>)</span>
    <br /><em class="fname">(Indexing operator)</em>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </tr></table>
  
  <p>Get records from a concatenated set of variables.</p>
  <dl class="fields">
    <dt>Overrides:
        _Variable.__getitem__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">time</span>,
        <span class="sig-arg">units</span>=<span class="sig-default">None</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </tr></table>
  
  <p>Create a time Variable with units consistent across a multifile 
  dataset.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>time</code></strong> - Time variable from a MFDataset.</li>
        <li><strong class="pname"><code>units</code></strong> - Time units, for example, 'days since 1979-01-01'. If None, use 
          the units from the master variable.</li>
    </ul></dd>
    <dt>Overrides:
        _Variable.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="netCDF4-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Thu Nov 14 09:25:36 2013
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
